package com.freesky.biz.abchina.controller;

import com.freesky.biz.abchina.domain.TRightsOrderRecord;
import com.freesky.biz.abchina.domain.TSpecialGiftRecord;
import com.freesky.biz.abchina.service.IRightsOrderService;
import com.freesky.biz.abchina.service.ISpecialGiftService;
import com.freesky.common.annotation.Log;
import com.freesky.common.core.controller.BaseController;
import com.freesky.common.core.domain.AjaxResult;
import com.freesky.common.core.page.TableDataInfo;
import com.freesky.common.enums.BusinessType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 福建农行信用卡专项权益赠送平台
 */
@RestController
@RequestMapping("/abchina/special/gift")
public class SpecialGiftController extends BaseController {

    @Autowired
    private ISpecialGiftService specialGiftService;

    /**
     * 信用卡专项权益
     */
    @PreAuthorize("@ss.hasPermi('abchina:specialgift:list')")
    @GetMapping("/list")
    public TableDataInfo list(TSpecialGiftRecord specialGiftRecord) {
        startPage();
        List<TSpecialGiftRecord> list = specialGiftService.findList(specialGiftRecord);
        return getDataTable(list);
    }

    @Log(title = "专项权益赠送", businessType = BusinessType.EXPORT)
    @PreAuthorize("@ss.hasPermi('abchina:specialgift:export')")
    @GetMapping("/export")
    public AjaxResult export(TSpecialGiftRecord specialGiftRecord,
                             HttpServletResponse response) {
        return specialGiftService.exportFile(specialGiftRecord);
    }
}
